package cn.wolfcode.luowowo.search.query;

import cn.wolfcode.luowowo.common.query.QueryObject;
import lombok.Getter;
import lombok.Setter;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;



@Getter
@Setter
public class SearchQueryObject extends QueryObject {
    //条件类型
    public static final int CONDITION_TYPE_ABROAD = 0;//国外
    public static final int CONDITION_TYPE_UN_ABROAD = 1;//国内
    public static final int CONDITION_TYPE_THEME = 2;//主题

    //排序
    private String orderBy = "viewnum";//排序
    private int type = -1;//条件类别
    private int typeValue;//条件值
    private Long destId = -1L;//目的地id
    public Pageable getPageable(){
        PageRequest of = PageRequest.of(super.getCurrentPage() - 1, super.getPageSize(), Sort.Direction.DESC, orderBy);
        return of;
    }
    public Pageable getPageableWithoutSort(){
        PageRequest of = PageRequest.of(super.getCurrentPage() - 1, super.getPageSize());
        return of;
    }


}
